package com.wjw.java.oop.extends_.demo;

import com.wjw.java.oop.extends_.demo.Student;

/**
 * 小学生,子类
 * 继承父类Student
 */
public class Pupil extends Student {
    //子类特有的属性
    private String aihao;

    public String getAihao() {
        return this.aihao;
    }

    public void setAihao(String aihao) {
        this.aihao = aihao;
    }

    public Pupil() {
        //super();//默认调用父类的无参构造,哪怕没有写
        System.out.println("Pupil子类：无参构造");
    }

    public Pupil(String name, int age, int score, String aihao) {
        super(name, age, score);//调用父类的有参构造
        this.aihao = aihao;
        System.out.println("Pupil子类：有参构造！！！");
    }

    //子类特有的方法
    public void myAihao(){
        System.out.println("小学生喜欢："+this.aihao);
    }
}
